<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:p="http://primefaces.org/ui"> 

<h:head> <title>TravelDream</title>
	<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
</h:head> 
<body> 

	
	<h:outputStylesheet library="css" name="primefaces-style.css"/>

	<p:panel header="Admin Console">
		<h:panelGrid columns="10" cellpadding="3">
			<h:link outcome="homePage" value="Admin Console"/>
			
			 <h:link outcome="createTravelPackage" value="new package" />  
			  
			  <h:link outcome="newFlight" value="new flight"/>
			  
			  <h:link outcome="newHotel" value="new hotel"/> 
			  
			  <h:link outcome="newExcursion" value="new excursion"/>
			  
			  <h:link outcome="showAllPackages" value="show all packages" /> 
			 
			 <h:outputText value="show all hotels" /> 
			   
			  <h:link outcome="showAllFlights" value="show All flights"/>
			   
			  <h:link outcome="showExcursion" value="show excursions"/> 
			  
			  <h:link outcome="manageCity" value="manage city"/>
			  
	 
			  <h:form>
				<p:commandButton id="logoutButton" value="logout" action="#{logout.logout()}"/>
			</h:form>
		</h:panelGrid>
	</p:panel>
	
<div id="resultHotel">
		<p:panel header="All Hotel" rendered="#{!hotels.edit}" styleClass="orange-header">
	
		
			<h:form >  
		    	<p:dataTable id="resultDataTableHotel" var="HotelDTO" value="#{hotels.hotelList}">  

			       <p:column headerText="Id" filterBy="id" filterMatchMode="contains">  
			            <h:outputText value="#{HotelDTO.id}" />  
			       </p:column>  
			     
			      <p:column headerText="Description" filterBy="description" filterMatchMode="contains">  
			            <h:outputText value="#{HotelDTO.description}" />  
			        </p:column>  
			  
			      <p:column headerText="name" filterBy="name" filterMatchMode="contains">  
			            <h:outputText value="#{HotelDTO.name}" />  
			        </p:column>  
			        
			         <p:column headerText="city" filterBy="city" filterMatchMode="contains">  
			            <h:outputText value="#{HotelDTO.city}" />  
			        </p:column>  
			        
			 		 <p:column headerText="Address">  
			            <h:outputText value="#{HotelDTO.address}" />  
			        </p:column>
			        
			         <p:column headerText="stars" filterBy="stars" filterMatchMode="contains">  
			            <p:rating value="#{HotelDTO.stars}" readonly="true" />  
			        </p:column>
			        
			        <p:column headerText="Price(EUR x night)">  
			            <h:outputText value="#{HotelDTO.price}" />  
			        </p:column>
			        
			        <p:column headerText="IsActive" filterBy="active" filterMatchMode="contains">  
			            <h:outputText value="#{HotelDTO.active}" />  
			        </p:column>
			     
			       <p:column headerText="">  
			            <p:commandButton value="edit" action="#{hotels.editButton(HotelDTO)}" ajax="false"/> 
			        </p:column>
			        
			         <p:column headerText="">  
			        <p:commandButton value="Delete" action="#{hotels.removeHotel(HotelDTO)}" ajax="false"/>
			        </p:column>
			        
			        <p:column headerText="">  
			        
			        <p:commandButton value="Activate" action="#{hotels.activate(HotelDTO)}" ajax="false" rendered="#{!HotelDTO.active}"/>
  
			        <p:commandButton value="Disable" action="#{hotels.disable(HotelDTO)}" ajax="false" rendered="#{HotelDTO.active}"/>
			        </p:column>
			     		  
    	</p:dataTable>  
    	
	</h:form>  	
		
		</p:panel>

</div>



	<p:panel header="Edit Hotel" rendered="#{hotels.edit}" styleClass="orange-header">
	<h:form >
	
	
        <h:panelGrid columns="3" cellpadding="5">  
            
     		<h:outputText value="id" />  
           	<h:outputText value="#{hotels.selectedHotel.id}" />
 			<h:outputText value="" />
 			
 			 <h:outputText value="name" />  
     		<p:inputText value="#{hotels.selectedHotel.name}"/>
     		<h:outputText value="#{hotels.errorName}" />
           	
            <h:outputText value="Description" />  
			<p:inputText value="#{hotels.selectedHotel.description}"/>  
			<h:outputText value="#{hotels.errorDescription}" />   
			                   
     		<h:outputText value="Address" />  
     		<p:inputText value="#{hotels.selectedHotel.address}"/>
     		<h:outputText value="#{hotels.errorAddress}" />
     		
     		 <h:outputText value="City" /> 
     		<p:selectOneMenu value="#{hotels.selectedHotel.city}"  panelStyle="width:150px" 
        		 effect="fade" var="p" style="width:160px"  filter="true" filterMatchMode="startsWith">
        		 <f:selectItem itemLabel="Select One" itemValue="" /> 
        		<f:selectItems value="#{cityBean.allCityList}" var="CityDTO" itemLabel="#{CityDTO.city}" itemValue="#{CityDTO.city}"/>
         		</p:selectOneMenu> 
     		<h:outputText value="#{hotels.errorCity}" />
     		
     		<h:outputText value="Stars " />
 			<p:rating value="#{hotels.selectedHotel.stars}" stars="5" cancel="false"/> 
 			<h:outputText value="" /> 
     		
     		<h:outputText value="Price(EUR x night)" />  
     		<p:inputText value="#{hotels.selectedHotel.price}"/>
     		<h:outputText value="#{hotels.errorPrice}" /> 
			
			<p:commandButton value="edit" action="#{hotels.saveEdit()}" ajax="false"/> 
			<p:commandButton value="cancel" action="#{hotels.cancel()}" ajax="false"/> 
        </h:panelGrid>  
      </h:form> 
       
       </p:panel> 

  <p:panel header="Error" rendered="#{hotels.prova}" styleClass="error-header">
  	<h:outputText value="#{hotels.errorDelete}" />
	<h:outputText value="#{hotels.errorEdit}" />
</p:panel>

</body> 
</html>
